from rest_framework import serializers

from goods.models import SKU


class OrdersSKUSerializer(serializers.ModelSerializer):

    count = serializers.IntegerField(label='商品数量')

    class Meta:
        model=SKU
        fields = ['id', 'name', 'default_image_url', 'price', 'count']

class OrdersPlaceSerializer(serializers.Serializer):

    freight = serializers.DecimalField(label='订单运费',decimal_places=2,max_digits=5)
    skus = OrdersSKUSerializer(many=True)